/*
ls_speed_mode.h
offer leisai motor driver for speed mode control api and data type define
designed by lunanting

recoder
-------------------------
2020-11-25 15:22:53
create file
------------------------

*/
#ifndef LS_SPEED_MODE_H
#define LS_SPEED_MODE_H

#include "../../bsp/base_type.h"
#include "../../../include/aos/kernel.h"


/*****************************type define*************************************/

//leida
typedef struct {
    u8 port;    //can port
    u8 node;    //can node id
}LS_SPEED_can;

//leida
typedef struct{
    s8 init;    //obj init status,0=uninit,1=init
    s8 dir;     //motor dir,-1=reverse,0=stop,1=forward
    u8 error;   //error status,0=no error,other = error code
    aos_mutex_t mux;    //mutex locker
    u16 motor_speed;    //speed : r/min
    LS_SPEED_can can;   //can state
}LS_SPEED_class;


/******************************function extern**********************************/
extern int xp_LSspeed_init(int id,int motor_speed,LS_SPEED_class *motor);   //init a speed mode leisai motor object
extern int xp_LSspeed_run_set(LS_SPEED_class *motor,int set);   //speed mode run set
extern int xp_LSspeed_debug(char *type,char *fun,char *param);  //leisai speed motor debug





#endif
//end of the file
